
<div class="modal" ng-controller="FlowableVariableAggregationsPopupCtrl">
    <div class="modal-dialog modal-wide">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" ng-click="close()">&times;</button>
                <h2>{{'PROPERTY.PROPERTY.EDIT.TITLE' | translate}} "{{property.title | translate}}"</h2>
            </div>
            <div class="modal-body">
            
                <div class="row row-no-gutter">
                    <div class="col-xs-4">
                        <div ng-if="translationsRetrieved" class="kis-listener-grid" ui-grid="gridOptions" ui-grid-selection></div>
                        <div class="pull-right">
                            <div class="btn-group">
                                <a class="btn btn-icon btn-lg" rel="tooltip" data-title="{{'ACTION.MOVE.UP' | translate}}" data-placement="bottom" data-original-title="" title="" ng-click="moveAggregationUp()"><i class="glyphicon glyphicon-arrow-up"></i></a>
                                <a class="btn btn-icon btn-lg" rel="tooltip" data-title="{{'ACTION.MOVE.DOWN' | translate}}" data-placement="bottom" data-original-title="" title="" ng-click="moveAggregationDown()"><i class="glyphicon glyphicon-arrow-down"></i></a>
                            </div>
                            <div class="btn-group">
                                <a class="btn btn-icon btn-lg" rel="tooltip" data-title="{{'ACTION.ADD' | translate}}" data-placement="bottom" data-original-title="" title="" ng-click="addNewAggregation()"><i class="glyphicon glyphicon-plus"></i></a>
                                <a class="btn btn-icon btn-lg" rel="tooltip" data-title="{{'ACTION.REMOVE' | translate}}" data-placement="bottom" data-original-title="" title="" ng-click="removeAggregation()"><i class="glyphicon glyphicon-minus"></i></a>
                            </div>
                        </div>
                    </div>
            
                    <div class="col-xs-8">

                        <div ng-show="selectedAggregation">

                            <div class="form-group">
                                <label for="targetField">{{'PROPERTY.PARAMETER.TARGET' | translate}}</label>
                                <input type="text" id="targetField" class="form-control" ng-model="selectedAggregation.target" placeholder="{{'PROPERTY.PARAMETER.TARGET.PLACEHOLDER' | translate}}" />
                            </div>
                            <div class="form-group">
                                <label for="targetExpressionField">{{'PROPERTY.PARAMETER.TARGETEXPRESSION' | translate}}</label>
                                <input type="text" id="targetExpressionField" class="form-control" ng-model="selectedAggregation.targetExpression" placeholder="{{'PROPERTY.PARAMETER.TARGETEXPRESSION.PLACEHOLDER' | translate}}" />
                            </div>

                            <div class="form-group">
                                <label for="classField">{{'PROPERTY.VARIABLE.AGGREGATIONS.CLASS' | translate}}</label>
                                <input type="text" id="classField" class="form-control" ng-model="selectedAggregation.class" ng-change="listenerDetailsChanged()" placeholder="{{'PROPERTY.VARIABLE.AGGREGATIONS.CLASS.PLACEHOLDER' | translate}}" />
                            </div>
                            <div class="form-group">
                                <label for="delegateExpressionField">{{'PROPERTY.VARIABLE.AGGREGATIONS.DELEGATEEXPRESSION' | translate}}</label>
                                <input type="text" id="delegateExpressionField" class="form-control" ng-model="selectedAggregation.delegateExpression" placeholder="{{'PROPERTY.VARIABLE.AGGREGATIONS.DELEGATEEXPRESSION.PLACEHOLDER' | translate}}" />
                            </div>

                            <div class="form-inline">
                                <div class="form-group col-xs-2" >
                                    <label for="createOverviewField">{{'PROPERTY.VARIABLE.AGGREGATIONS.CREATEOVERVIEW' | translate}}</label>
                                    <input id="createOverviewField" class="checkbox" type="checkbox" ng-model="selectedAggregation.createOverview" ng-disabled="selectedAggregation.storeAsTransient" />
                                </div>
                                <div class="form-group col-xs-2">
                                    <label for="storeAsTransientField">{{'PROPERTY.VARIABLE.AGGREGATIONS.STOREASTRANSIENT' | translate}}</label>
                                    <input id="storeAsTransientField" class="checkbox" type="checkbox" ng-model="selectedAggregation.storeAsTransient" ng-disabled="selectedAggregation.createOverview" />
                                </div>
                            </div>

                            <div style="padding-bottom:10px">
                                <div class="row row-no-gutter">
                                    <div class="col-xs-6">
                                        <div ng-if="translationsRetrieved" class="kis-listener-grid" ui-grid="definitionGridOptions" ui-grid-selection ui-grid-auto-resize></div>
                                        <div class="pull-right">
                                            <div class="btn-group">
                                                <a class="btn btn-icon btn-lg" rel="tooltip" data-title="{{'ACTION.MOVE.UP' | translate}}" data-placement="bottom" data-original-title="" title="" ng-click="moveVariableDefinitionValueUp()"><i class="glyphicon glyphicon-arrow-up"></i></a>
                                                <a class="btn btn-icon btn-lg" rel="tooltip" data-title="{{'ACTION.MOVE.DOWN' | translate}}" data-placement="bottom" data-original-title="" title="" ng-click="moveVariableDefinitionValueDown()"><i class="glyphicon glyphicon-arrow-down"></i></a>
                                            </div>
                                            <div class="btn-group">
                                                <a class="btn btn-icon btn-lg" rel="tooltip" data-title="{{'ACTION.ADD' | translate}}" data-placement="bottom" data-original-title="" title="" ng-click="addNewVariableDefinitionValue()"><i class="glyphicon glyphicon-plus"></i></a>
                                                <a class="btn btn-icon btn-lg" rel="tooltip" data-title="{{'ACTION.REMOVE' | translate}}" data-placement="bottom" data-original-title="" title="" ng-click="removeVariableDefinitionValue()"><i class="glyphicon glyphicon-minus"></i></a>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="col-xs-6">
                                        <div ng-show="selectedVariableDefinitionValue">

                                            <div class="form-group">
                                                <label for="sourceVariableDefinitionField">{{'PROPERTY.PARAMETER.SOURCE' | translate}}</label>
                                                <input type="text" id="sourceVariableDefinitionField" class="form-control" ng-model="selectedVariableDefinitionValue.source" placeholder="{{'PROPERTY.PARAMETER.SOURCE.PLACEHOLDER' | translate}}" />
                                            </div>
                                            <div class="form-group">
                                                <label for="sourceExpressionVariableDefinitionField">{{'PROPERTY.PARAMETER.SOURCEEXPRESSION' | translate}}</label>
                                                <input type="text" id="sourceExpressionVariableDefinitionField" class="form-control" ng-model="selectedVariableDefinitionValue.sourceExpression" placeholder="{{'PROPERTY.PARAMETER.SOURCEEXPRESSION.PLACEHOLDER' | translate}}" />
                                            </div>
                                            <div class="form-group">
                                                <label for="targetVariableDefinitionField">{{'PROPERTY.PARAMETER.TARGET' | translate}}</label>
                                                <input type="text" id="targetVariableDefinitionField" class="form-control" ng-model="selectedVariableDefinitionValue.target" placeholder="{{'PROPERTY.PARAMETER.TARGET.PLACEHOLDER' | translate}}" />
                                            </div>
                                            <div class="form-group">
                                                <label for="targetExpressionVariableDefinitionField">{{'PROPERTY.PARAMETER.TARGETEXPRESSION' | translate}}</label>
                                                <input type="text" id="targetExpressionVariableDefinitionField" class="form-control" ng-model="selectedVariableDefinitionValue.targetExpression" placeholder="{{'PROPERTY.PARAMETER.TARGETEXPRESSION.PLACEHOLDER' | translate}}" />
                                            </div>
                                        </div>
                                        <div ng-show="!selectedVariableDefinitionValue" class="muted no-property-selected" translate>PROPERTY.VARIABLE.AGGREGATIONS.DEFINITIONS.UNSELECTED</div>
                                    </div>
                                </div>
                            </div>

                        </div>

                        <div ng-show="!selectedAggregation" class="muted no-property-selected" translate>PROPERTY.VARIABLE.AGGREGATIONS.UNSELECTED</div>
                    </div>
                </div>
            
            </div>
            <div class="modal-footer">
                <button ng-click="cancel()" class="btn btn-primary" translate>ACTION.CANCEL</button>
                <button ng-click="save()" class="btn btn-primary" translate>ACTION.SAVE</button>
            </div>
        </div>
    </div>
</div>
